home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_aet_lightning.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  136 lines

  1. # Jones 3D Cog Script
  2. #
  3. # aet_Lightning.cog
  4. #
  5. # [TL] [RD]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. # ========================================================================================
  9. symbols
  10.  
  11. message        timer
  12. message        startup
  13. message        entered
  14. message     exited
  15. message        crossed
  16.  
  17. thing        origin0                                                # Lightning targets.            
  18. thing        target0
  19. thing        lightThing                                            # Dynamic lightthing.
  20. thing        player                                        local
  21.  
  22. surface        startAdjoin
  23. surface        stopAdjoin
  24.  
  25. material    lightningmat0=aet_4sfx_lightning_v2_a.mat    local    # Mats for the lightning.
  26. material    lightningmat1=aet_4sfx_lightning_v2_b.mat    local
  27. material    lightningmat2=aet_4sfx_lightning_v2_c.mat    local
  28. material    lightningmat3=aet_4sfx_lightning_v2_d.mat    local
  29. material    lightningmat4=aet_4sfx_lightning_v2_e.mat    local
  30.  
  31. sector        damagesec                                            # Lightning strike sectors.
  32.  
  33. sound        strike0=aet_lightning_01.wav                local
  34. sound        strike1=aet_lightning_02.wav                local
  35. sound        strike2=aet_lightning_03.wav                local
  36. sound        strike3=aet_lightning_04.wav                local
  37.  
  38. int            toggle                                        local
  39. int            cnt                                            local
  40. int            randnum                                        local
  41. int            soundcheck=0                                
  42. int            strikechannel                                local
  43.  
  44. end
  45.  
  46. # ========================================================================================
  47. code
  48.  
  49. startup:
  50.  
  51. player = GetLocalPlayerThing();
  52.  
  53. SetThingFlags(lightThing, 0x80000);
  54.  
  55. return;
  56.  
  57. # ........................................................................................
  58. crossed:
  59.  
  60. if (GetSourceRef() != player) 
  61.     {
  62.     
  63.     return;
  64.     
  65.     }
  66. if (GetSenderRef() == startAdjoin)
  67.     {
  68.     SetTimer(1.0);
  69.     }
  70. else if (GetSenderRef() == stopAdjoin)
  71.     {
  72.     SetTimer(0.0);
  73.     }
  74.  
  75. return;
  76.  
  77. # ........................................................................................
  78. entered:
  79.  
  80. # Damage indy if he enters the certain sector.
  81. if (GetSenderRef() == damagesec)
  82.     {
  83.     toggle = 1;
  84.     }
  85.  
  86. return;
  87.  
  88. # ........................................................................................
  89. exited:
  90.  
  91. # Stop damaging Indy when he leaves sector.
  92. if (GetSenderRef() == damagesec)
  93.     {
  94.     toggle = 0;
  95.     }
  96.  
  97. return;
  98.  
  99. # ........................................................................................
  100. timer:
  101.  
  102. # Lightning code.
  103. ClearThingFlags(lightThing, 0x80000);
  104. if (toggle == 0)
  105.     {
  106.     for (cnt = 2; cnt <= RandBetween(2, 5); cnt = cnt + 1)
  107.         {
  108.         CreatePolylineThing(origin0, target0, '0 0 0', lightningmat0[RandBetween(0, 4)], 0.1, 0.1, 0.05);
  109.         randnum = RandBetween(0, 3);
  110.         if (soundcheck == 1)
  111.             {
  112.             strikechannel = PlaySoundThing(strike0[randnum], target0, 0.35, 2.5, 10.0, 0);
  113.             }
  114.         Sleep(0.05);
  115.         }
  116.     }
  117. if (toggle == 1)
  118.     {
  119.     CreatePolylineThing(origin0, player, '0 0 0', lightningmat0[RandBetween(0, 4)], 0.1, 0.1, 0.05);
  120.     randnum = RandBetween(0, 3);
  121.     if (soundcheck == 1)
  122.         {
  123.         strikechannel = PlaySoundThing(strike0[randnum], target0, 0.35, 2.5, 10.0, 0);
  124.         }
  125.     DamageThing(player, 100, 0x1, damagesec);
  126.     }
  127.  
  128. SetTimer(Rand() * 1.5);
  129. SetThingFlags(lightThing, 0x80000);
  130. //StopSound(strikechannel, 0);
  131.  
  132. return;
  133.  
  134. # ........................................................................................
  135. end